const Router = require("koa-router");
const router = new Router();
const home = require("../controllers/home")
const music = require("../controllers/music")
const my = require("../controllers/my")

// router.get("/home", home)
// router.get("/music", music)
// router.post("/my", my)

const routes = [
    {
        path: "/home",
        component: home
    },
    {
        path: "/music",
        component: music
    },
    {
        method: "post",
        path: "/my",
        component: my
    },
]
routes.forEach(item => {
    if (item.method == "post") {
        router.post(item.path, item.component)
    } else {
        router.get(item.path, item.component)
    }
})

module.exports = router;